package org.campuscontent.ui;

import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

import org.campuscontent.config.Config;
import org.campuscontent.main.MainFrame;

public class Template15 extends TemplateBase
{
	public static int paraID = 15;
	JRadioButton optYes;
	JRadioButton optNo;
	JTextArea TextfieldMatch ;
	public Template15(MainFrame mf)
	{
		super(mf);
	
		optYes = new JRadioButton();
		optNo = new JRadioButton();
		ButtonGroup groupOpt = new ButtonGroup();
		optYes.setText(Config.Tp15OptYes);
		optNo.setText(Config.Tp15OptNo);
		groupOpt.add(optYes);
		groupOpt.add(optNo);
		JLabel label = new JLabel();
		label.setText(Config.Tp15LabelReg);

		TextfieldMatch = new JTextArea();
		TextfieldMatch.setLineWrap(true);
		JScrollPane scrollPane = new JScrollPane(TextfieldMatch);
		scrollPane.setBorder(BorderFactory.createLoweredBevelBorder());
		

		optYes.setBounds(5,5,100,20);
		optNo.setBounds(120,5,100,20);
		label.setBounds(5,23,300,20);
		scrollPane.setBounds(5,46,600,80);
		left.add(optYes);
		left.add(optNo);
		left.add(label);
		left.add(scrollPane);
		initView();
	}


	public void initView()
	{
		mf.rootPanel.setDividerLocation(Config.ROOT_HEIGHT);
		this.setDividerLocation(Config.POSITION_TO_HIDE_PROBLEM_CONTROLS);
	}

	public String getAnswer()
	{
		return "";
	}
	
	public boolean setPreview()
	{
		if (!super.setPreview()) return false;
		mf.rootPanel.setDividerLocation(Config.POSITION_TO_SHOW_TEMPLATE-40);
		return true;
	}

	public boolean exitPreview()
	{
		super.exitPreview();
		return true;
	}

	public String checkAns()
	{
		return "";
	}

	public void showSolution()
	{
		super.showSolution();
	}
	
	public boolean updateToLObjectNew()
	{
//		//first check if the user have set the 
//		sAnswer = getAnswer();
//		if (sAnswer.equals("none#none#none#none#"))
//		{
//			JOptionPane.showMessageDialog(getWindowForComponent(mf.applet), "You should set the answer!");
//			return false;
//		} else
		{
			super.updateToLObjectNew();
			return true;
		}
	}
	public int getId()
	{
		return paraID;
	}
	
}
